package cn.wolf.sqlite.dao;

import java.util.List;
import java.util.Map;

import android.database.sqlite.SQLiteOpenHelper;
/**
 * 
 * <h3>基础Sqlite Dao包</h3>
 */
public interface BaseDao<T> {

	public SQLiteOpenHelper getDbHelper();
	
	public abstract long insert(T entity);
	
	public abstract void delete(int id);
	
	public abstract void delete(Integer... ids);
	
	public abstract void deleteAll();

	public abstract void update(T entity);

	public abstract T get(int id);

	public abstract List<T> rawQuery(String sql, String[] selectionArgs);

	public abstract List<T> find();

	public abstract List<T> find(String[] columns, String selection,
			String[] selectionArgs, String groupBy, String having,
			String orderBy, String limit);

	public abstract boolean isExist(String sql, String[] selectionArgs);

	/**
	 * 查询并转为Map的list数据格式
	 * @param sql
	 *            SQL语句
	 * @param selectionArgs
	 *            参数
	 * @return List<Map<String, String>>
	 */
	public List<Map<String, String>> query2MapList(String sql,
			String[] selectionArgs);
	
	/**
	 * 执行SQL语句
	 * @param sql
	 * 		SQL语句
	 * @param selectionArgs
	 * 		SQL语句执行参数
	 */
	public void execSql(String sql, Object[] selectionArgs);

}